<?php
require "vendor/autoload.php";

use JsonStreamingParser\Listener\InMemoryListener;
use JsonStreamingParser\Parser;

$testfile = 'ratherBig.json';

//var_dump($stream);
//$json_string = file_get_contents($testfile);
//$jsonArr = json_decode($json_string,true);
//var_dump($jsonArr);


$listener = new InMemoryListener();
$stream = fopen($testfile, 'r');
try {
    $parser = new Parser($stream, $listener);
    $parser->parse();
    fclose($stream);
} catch (Exception $e) {
    fclose($stream);
    throw $e;
}

var_dump($listener->getJson());